<template>
	<view>
		<view class="box u-fc u-f-ajc">
			<image src="../../../static/logo.jpg" mode="aspectFill"></image>
			<view class="text-black">美好生活从心开始</view>
			<view class="margintop text-bold text-df">授权微信昵称和头像</view>
			<view>更方便商家为您服务</view>
			<u-button type="primary" size="medium" shape="circle" :custom-style="customStyle" @click="wechatAuth">获取头像昵称</u-button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				customStyle: {
					marginTop: '70rpx', // 注意驼峰命名，并且值必须用引号包括，因为这是对象
					backgroundColor: '#2ba4f7',
					width: '450rpx',
					height: '78rpx'
				}
			};
		},
		methods:{
			//微信授权获取用户信息
			wechatAuth() {
				let that = this;
				uni.getUserProfile({
					desc: '授权登录', // 声明获取用户个人信息后的用途，后续会展示在弹窗中，请谨慎填写
					success: res => {
						uni.setStorageSync('wechatAuth', res);
						uni.showToast({
							title: "授权成功,快去登陆吧~",
							icon:"none"
						});
						setTimeout(()=>{
							this.$u.route({url:'/pages/auth/btnAuth/btnAuth',type:'redirect'})
						},1000)
						
					}
				});
			}
		}
	}
</script>
<style>
	page{
		height: 100vh;
		overflow: hidden;
		background-color: #fff;
	}
</style>

<style lang="scss" scoped>
.box{
	height: 70vh;
	text-align: center;
	padding: 0;
	line-height: 45rpx;
	font-size: 28rpx;
	image{
		width: 200rpx;
		height: 200rpx;
		display: block;
		margin:  80rpx auto 30rpx;
	}
}
.margintop{
	margin-top: 70rpx;
}
</style>
